<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-form ref="form" :model="t_quote" :rules="rules" label-width="100px" id="mvcfm">
      <el-button @click="gotoPage('/psi/supplychainmana/InventoryDet?'+vueparams+'')" type='primary' size="mini">任务确定</el-button>
      <el-button @click="gotoPage('/psi/supplychainmana/InventoryList?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>返回</el-button>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="盘存类别" prop="">
              {{t_quote.take_interval}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="盘存标题" prop="quote_name">
              {{t_quote.quote_name}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="价格大于" prop="">
              {{t_quote.take_gprice}}
            </el-form-item>
          </el-col>
          <el-col :span="12"> 元 </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="盘存开始日期" prop="take_begin_date">
              {{t_quote.take_begin_date}}
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="盘存要求时间" prop="take_ask_date">
              {{t_quote.take_ask_date}}
            </el-form-item>
          </el-col>
          <el-col :span="12"> 小时 </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div class="form-unit">
        <span class="mvc-title-left"> 物料列表 </span>
      </div>
      <el-table :data="p_product">
        <el-table-column label="操作" align="center" width='100' type=''>
          <template slot-scope="scope">
            <el-dropdown trigger="click">
              <span class="el-dropdown-link">操作<i class="el-icon-arrow-down el-icon--right"></i></span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>
                  <el-link @click="d_product('&CMID4='+scope.row.note_id+'')">删除</el-link>
                </el-dropdown-item>
                <el-dropdown-item>
                  <el-link @click="popReplaceLib('&CMIDrecod_id='+scope.row.note_id+'')">替换库管员</el-link>
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </template>
        </el-table-column>
        <el-table-column label="#" align="center" type='index'>
        </el-table-column>
        <el-table-column label="产品条形码" prop="product_barcode">
        </el-table-column>
        <el-table-column label="类型" prop="menu_class">
        </el-table-column>
        <el-table-column label="产品名称" prop="product_name">
        </el-table-column>
        <el-table-column label="产品厂家" prop="client_name">
        </el-table-column>
        <el-table-column label="规格型号" prop="model_norm">
        </el-table-column>
        <el-table-column label="结余数" prop="product_num">
        </el-table-column>
        <el-table-column label="仓管员" prop="role">
        </el-table-column>
        <el-table-column label="库管员" prop="contact_name">
        </el-table-column>
      </el-table>
      <pagination v-show="total>0" :total="total" :limit.sync="pageSize" @pagination="getPage" />
      <div class="form-unit">
        <span class="mvc-title-left"> 统计 </span>
      </div>
      <div>
        <el-row>
          <el-col :span="24">
            <el-form-item label="产品总数" prop="">
              {{t_product.num}}
            </el-form-item>
          </el-col>
        </el-row>
      </div>
    </el-form>
    <el-dialog :visible.sync="ReplaceLibVisible" append-to-body>
      <ReplaceLib v-if="ReplaceLibVisible" ref="ReplaceLib" :popparams="popparams"> </ReplaceLib>
    </el-dialog>
  </div>
</template>
<script>
  import request from '@/utils/request'
  import ReplaceLib from "@/views/psi/supplychainmana/ReplaceLib";
  export default {
    name: 'InventoryDetailsSupply',
    components: {
      ReplaceLib,
    },
    props: ['popparams'],
    data() {
      return {
        ReplaceLibVisible: false,
        ReplaceLibValue: null,
        ReplaceLibDesc: null,
        vueparams: this.getVUEParams(""),
        t_quote: {
          take_interval: null,
          quote_name: null,
          take_gprice: null,
          take_begin_date: null,
          take_ask_date: null,
        },
        p_product: [],
        t_product: {
          num: null,
        },
        loading: false,
        rules: {}
      }
    },
    created() {
      this.getData();
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/main/InventoryAction/inventoryDetailsSupply?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      d_product(_params) {
        request({
          method: 'post',
          url: '/xcapi/VUEAction/psi/main/InventoryAction/d_product?' + _params + this.vueparams,
          data: this.postData()
        }).then(data => {
          this.$router.replace("/redirect" + this.$route.fullPath);
          this.msgSuccess(data.msg);
        })
      },
      popReplaceLib(params) {
        if (params != "") this.popparams = params + this.vueparams;
        this.ReplaceLibVisible = !this.ReplaceLibVisible;
      },
    },
  }
</script>
